<?php

class ConfigsController extends AppController
{

	function admin_edit($cat = 1)
	{
		if (!empty($this->data))
		{
			$this->Conf->set('general.sitename', $this->data['Config']['sitename'], null, true, true);
			$this->Conf->set('general.sitedesc', $this->data['Config']['sitedesc'], null, true, true);
			$this->Conf->set('general.siteurl', $this->data['Config']['siteurl'], null, true, true);
			$this->Conf->set('general.enable_comments', $this->data['Config']['enable_comments'], array(0,1), true, true);
			$this->Conf->set('general.enable_captcha', $this->data['Config']['enable_captcha'], array(0,1), true, true);
			
			$this->redirect('/admin/configs/edit');	// Updates options when user saves.
		}
	}
	
	function admin_video($cat = 2)
	{
		if (!empty($this->data))
		{
			$this->Conf->set('video.width', $this->data['Config']['width'], 320, true, true);
			$this->Conf->set('video.height', $this->data['Config']['height'], 240, true, true);
			$this->Conf->set('video.samplerate', $this->data['Config']['samplerate'], 22050, true, true);
			$this->Conf->set('video.bitrate', $this->data['Config']['bitrate'], 32, true, true);
			
			$this->redirect('/admin/configs/video');	// Updates options when user saves.
		}
	}
}
?>